package com.xgimi.open.skill.datamanager.biz.common.Enum;

import lombok.Getter;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 自定义异常码
 * @date 2023/2/3 15:02
 */
@Getter
public enum ExceptionErrorCode {

    UN_KNOW_ERROR(500, "系统未知错误"),
    PARAMS_ERROR(400, "参数异常"),


    // 产品相关
    PRODUCT_NAME_ALREADY_EXISTS(500001, "产品名称重复"),
    PRODUCT_NOT_EXISTS(500002, "产品不存在"),
    P_VERSION_NAME_ALREADY_EXISTS(500003, "产品版本名称重复"),

    // 技能相关
    SKILL_NAME_ALREADY_EXISTS(500004, "技能名称重复"),
    SKILL_ID_IS_NULL(500005, "技能id为空"),
    SKILL_NOT_EXISTS(500006, "技能不存在"),

    // 技能版本相关
    SKILL_VERSION_ID_IS_NULL(500007, "技能版本id为空"),
    SKILL_VERSION_NOT_EXISTS(500008, "技能版本不存在"),

    // 意图相关
    INTENT_NAME_ALREADY_EXISTS(500009, "意图名称重复"),
    Intent_ID_IS_NULL(5000010, "意图id为空"),
    INTENT_NOT_EXISTS(500011, "意图不存在"),
    // 词库相关
    WORDSTOCK_NAME_ALREADY_EXISTS(500012, "词库名称重复"),
    WORDSTOCK_ID_IS_NULL(5000013, "词库id为空"),
    WORDSTOCK_NOT_EXISTS(500014, "词库不存在"),

    // 槽位相关
    SOLT_NAME_ALREADY_EXISTS(500015, "槽位名称重复"),
    SOLT_ID_IS_NULL(500016, "槽位id为空"),
    SOLT_NOT_EXISTS(500017, "槽位不存在"),

    // 说法规则相关
    SPEECH_RULE_ID_IS_NULL(500018, "说法规则id为空"),
    SPEECH_RULE_NOT_EXISTS(500019, "说法规则不存在"),
    SPEECH_RULE_NOT_CONFORM(500020, "说法规则格式不正确"),

    SKILL_PUBLISHING(500021, "当前时间段存在其他用户发布该技能"),
    SKILL_UPDATE(500022, "当前时间段存在其他用户修改该技能"),

    // open-skill-nlu 相关
    SKILL_TRAIN_FAIL(500023, "技能训练失败"),

    UPDATE_FAIL(500024, "操作失败！当前可能不是最新数据，请先更新数据，重新操作"),
    SKILL_NAME_IS_NULL(500025, "技能名称不能为空"),
    ENTRY_HANDLE_TYPE_ISNULL(500026, "词条操作类型为空"),
    ENTRY_HANDLE_VALUE_ISNULL(500027, "词条操作归一值value为空"),
    ENTRY_HANDLE_SYNONYMS_ISNULL(500028, "词条操作同义词synonyms为空"),
    CAN_NOT_UPDATE(500029, "当前技能正在发版或者训练，不能修改数据"),
    TEST_VERSION_NOT_NEWEST(500030, "已有用户对该技能发版，请返回【版本列表】或者【技能列表】即可刷新到最新版本"),
    ENTRY_ID_IS_NULL(500031, "词条id为空"),
    BINDING_WORDSTOCK_CANNOT_DELETE(500032, "绑定词库不可删除"),
    REFERENCED_SLOT_CANNOT_DELETE(500033, "被引用的槽位不可删除"),
    INTENT_NOT_REFERENCE_SLOT(500034, "槽位名称不正确或者存在该意图未引用的槽位"),
    REFERENCED_CAN_NOT_UPDATE(500035, "已被引用的槽位不允许修改"),
    SKILL_UPDATE_TRAIN(500036, "当前操作过于频繁 或者 当前存在多用户对该技能进行写操作：包括增、删、改、训练、发布")
    ;

    ExceptionErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 错误码
     */
    private final int code;

    /**
     * 错误描述
     */
    private final String message;
}
